﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maxleaf.EDI.DataAccess.K3;
using Maxleaf.EDI.DataAccess.EDI;
using Maxleaf.EDI.Domain;

namespace Maxleaf.EDI.DataAccess.UnitOfWork
{
    public class EFUnitOfWorkProvider : IUnitOfWorkProvider
    {
        public IUnitOfWork GetEDIUnitOfWork()
        {
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["EDIContext"].ConnectionString;
            return new EFUnitOfWork
            {
                Context = new EDIContext(connectionString)
            };
        }


        public IUnitOfWork GetK3UnitOfWork(string dbId)
        {
            string connectionString =string.Format(System.Configuration.ConfigurationManager.ConnectionStrings["K3Context"].ConnectionString,dbId);
            return new EFUnitOfWork
            {
                Context = new K3Context(connectionString)
            };
        }
    }
}
